
<?php
    if (substr(PHP_VERSION, 0, 1) == '5') {
        define('PHP5', true);
    } else if (substr(PHP_VERSION, 0, 1) == '7') {
        define('PHP7', true);
    }
	date_default_timezone_set("PRC");
	$conn = new mysqli("localhost", "root", "root", "projectmgrdb");
    mysqli_set_charset($conn,'utf8');
    // 检测连接
    if ($conn->connect_error) {
        die("连接失败: " . $conn->connect_error);
    }

    function mysql_query($sql) {
        global $conn;
        return $conn->query($sql);
    }
    function mysql_fetch_array($result) {
        global $conn;
        return $result->fetch_assoc();
    }
    function mysql_error() {
        global $conn;
        return $conn->error;
    }
    function mysql_num_rows($result) {
        return $result->num_rows;
    }
?>